Euclidean Algorithm and Extended Euclidean Algorithm
Euclidean Algorithm
This algorithm allows you to find the greatest common factor (or greatest common divisor) of two numbers.
To do the Euclidean Algorithm, start with the larger number, , and write it as , where is the smaller number, is as large as possible, and then is the remainder. Then, on the next line, write an equation in the same form except is replaced by and is replaced by . Continue this way until , and the last non-zero value of is the greatest common divisor.
Example
:
The last non-zero remainder is the GCD, so that is 11 in this case.
Extended Euclidean Algorithm
The Extended Euclidean algorithm is used to calculate the multiplicative inverse of a number. This means finding a number for such that . This can only happen if numbers and are coprime, meaning they share no factors other than 1.
Example
To begin, you need to do the standard Euclidean algorithm:
to be continued...